#ifndef IHM_H
#define IHM_H

#include <QtGui/QMainWindow>
#include "ui_ihm.h"

#include "qpropertyanimation.h"
#include "qdir.h"
#include "qfiledialog.h"
#include "qpushbutton.h"
#include "qthread.h"

#include "qvumeter.h"

#include <vector>
#include <sstream>
#include "RealTimeAnalysis.h"
#include "QVisualizer.h"
#include "qchorus.h"
#include "qmetronome.h"
#include "qpitchdetector.h"
#include "qdistortion.h"


class IHM : public QMainWindow
{
	Q_OBJECT
	
	struct MTrack{
		QPushButton * samples[8];
		QPushButton * muteButton;
		QPushButton * soloButton;
		QPushButton * recButton;
		QSlider     * volumeSlider;
		QDial       * panDial;
		QVUMeter    * vuMeter;
		QWidget     * sampleMatrice;
	};
	public:
		IHM(QWidget *parent = 0, Qt::WFlags flags = 0);
		~IHM();
		Ui::IHMClass ui;
	public slots:
		void selectFile();
		void play();
		void play(int track, int row);

		void setPan(int value);
		void setVolume(int volume);
		void setMute();
		void setSolo();
		void setRec();

		void comp_setAtck(int);
		void comp_setRelease(int);
		void comp_setThreshold(int);
		void comp_setGain(int);
		void comp_activate();

		void setBPM(int);
		void setTPM(int);
		void setDuration(int);

		void stopAll();
		
		void launchMetronome(); 

		void launchPitchDetector();

	private:
		QDir directory;
		QString path;
		Manager *aManager;
		MTrack tracks[9] ;
		QPushButton *sampleButton[72];
		QLCDNumber *lcd;
		QVisualizer * qvisual;
		QChorus *qchorus;
		QDistortion *qdist;
		QMetronome *metronome;
		QPitchDetector *detector;

		//Metronome *metro;

		RealTimeAnalysis* ras[10];

		int currentTrack;

		void setPan(int trackID,int value);
		void setVolume(int trackID,int volume);

		void populateIHM();

		void updatePluginsValues();
};

#endif // IHM_H
